﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace Admin2505.Iinfrastructure.Migrations
{
    /// <inheritdoc />
    public partial class InitialCreass : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Apppermmission_AppRole_AppRoleId",
                table: "Apppermmission");

            migrationBuilder.DropIndex(
                name: "IX_Apppermmission_AppRoleId",
                table: "Apppermmission");

            migrationBuilder.DeleteData(
                table: "AppRolePermission",
                keyColumn: "Id",
                keyValue: new Guid("9bf5527a-aeaf-4fd1-92d4-77a116002d96"));

            migrationBuilder.DeleteData(
                table: "AppRolePermission",
                keyColumn: "Id",
                keyValue: new Guid("d91f93be-a5ec-4e43-9af8-07b2f06892f8"));

            migrationBuilder.DeleteData(
                table: "AppUserRole",
                keyColumn: "Id",
                keyValue: new Guid("68259246-c732-46fc-be16-e2bcfeb9f5a3"));

            migrationBuilder.DropColumn(
                name: "AppRoleId",
                table: "Apppermmission");

            migrationBuilder.InsertData(
                table: "AppRolePermission",
                columns: new[] { "Id", "CreatedAt", "CreatedBy", "DisplayOrder", "IsActived", "IsDelete", "PermissionId", "Remarks", "RoleId", "UpdatedAt", "UpdatedBy" },
                values: new object[,]
                {
                    { new Guid("01468d58-8e99-4036-8a6a-93a40011e6ee"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), 0, true, false, new Guid("00000000-0000-0000-0000-000000000004"), "", new Guid("00000000-0000-0000-0000-000000000002"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000") },
                    { new Guid("d8c72f43-7e63-46e6-b5af-ab94c125e06d"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), 0, true, false, new Guid("00000000-0000-0000-0000-000000000003"), "", new Guid("00000000-0000-0000-0000-000000000002"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000") }
                });

            migrationBuilder.InsertData(
                table: "AppUserRole",
                columns: new[] { "Id", "CreatedAt", "CreatedBy", "DisplayOrder", "IsActived", "IsDelete", "Remarks", "RoleId", "UpdatedAt", "UpdatedBy", "UserId" },
                values: new object[] { new Guid("432b3beb-cf4a-439e-834f-d2de8d2524c4"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), 0, true, false, "", new Guid("00000000-0000-0000-0000-000000000002"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000001") });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DeleteData(
                table: "AppRolePermission",
                keyColumn: "Id",
                keyValue: new Guid("01468d58-8e99-4036-8a6a-93a40011e6ee"));

            migrationBuilder.DeleteData(
                table: "AppRolePermission",
                keyColumn: "Id",
                keyValue: new Guid("d8c72f43-7e63-46e6-b5af-ab94c125e06d"));

            migrationBuilder.DeleteData(
                table: "AppUserRole",
                keyColumn: "Id",
                keyValue: new Guid("432b3beb-cf4a-439e-834f-d2de8d2524c4"));

            migrationBuilder.AddColumn<Guid>(
                name: "AppRoleId",
                table: "Apppermmission",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.InsertData(
                table: "AppRolePermission",
                columns: new[] { "Id", "CreatedAt", "CreatedBy", "DisplayOrder", "IsActived", "IsDelete", "PermissionId", "Remarks", "RoleId", "UpdatedAt", "UpdatedBy" },
                values: new object[,]
                {
                    { new Guid("9bf5527a-aeaf-4fd1-92d4-77a116002d96"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), 0, true, false, new Guid("00000000-0000-0000-0000-000000000004"), "", new Guid("00000000-0000-0000-0000-000000000002"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000") },
                    { new Guid("d91f93be-a5ec-4e43-9af8-07b2f06892f8"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), 0, true, false, new Guid("00000000-0000-0000-0000-000000000003"), "", new Guid("00000000-0000-0000-0000-000000000002"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000") }
                });

            migrationBuilder.InsertData(
                table: "AppUserRole",
                columns: new[] { "Id", "CreatedAt", "CreatedBy", "DisplayOrder", "IsActived", "IsDelete", "Remarks", "RoleId", "UpdatedAt", "UpdatedBy", "UserId" },
                values: new object[] { new Guid("68259246-c732-46fc-be16-e2bcfeb9f5a3"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), 0, true, false, "", new Guid("00000000-0000-0000-0000-000000000002"), new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000001") });

            migrationBuilder.UpdateData(
                table: "Apppermmission",
                keyColumn: "Id",
                keyValue: new Guid("00000000-0000-0000-0000-000000000003"),
                column: "AppRoleId",
                value: null);

            migrationBuilder.UpdateData(
                table: "Apppermmission",
                keyColumn: "Id",
                keyValue: new Guid("00000000-0000-0000-0000-000000000004"),
                column: "AppRoleId",
                value: null);

            migrationBuilder.CreateIndex(
                name: "IX_Apppermmission_AppRoleId",
                table: "Apppermmission",
                column: "AppRoleId");

            migrationBuilder.AddForeignKey(
                name: "FK_Apppermmission_AppRole_AppRoleId",
                table: "Apppermmission",
                column: "AppRoleId",
                principalTable: "AppRole",
                principalColumn: "Id");
        }
    }
}
